package com.okami.json;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @author: TanJingyu
 * @create: 2021-01-13 16:24
 **/
class JsonUtils {
    private static ObjectMapper json = new ObjectMapper();

    static String toString(Object o) throws JsonProcessingException {
        return json.writeValueAsString(o);
    }

    static <T> T toObject(String jstr, Class<T> t) throws JsonProcessingException {
        return json.readValue(jstr, t);
    }
}
